package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2;
import com.corona.Game;
import com.corona.game.util.SpriteProxy;
import com.corona.game.util.TextureCache;
import java.util.Locale;
import java.util.Map;

/* compiled from: Battle.java */
/* loaded from: pokewilds.jar:com/pkmngen/game/DrawEnemyHealth.class */
class DrawEnemyHealth extends Action {
    public static boolean shouldDraw = true;
    SpriteProxy bgSprite;
    SpriteProxy healthSprite;
    int currHealth;
    public Vector2 translateAmt;
    char[] levelChars;
    SpriteProxy levelCharacter;
    public Action.Layer layer;
    Map<Character, SpriteProxy> textDict;

    public DrawEnemyHealth(Game game) {
        this(game, false);
    }

    public DrawEnemyHealth(Game game, boolean inverseColors) {
        super(new Object[0]);
        this.translateAmt = new Vector2();
        this.layer = Action.Layer.gui_129;
        game.battle.drawAction.drawEnemyHealthActionGen1 = this;
        this.currHealth = (int) Math.ceil((double) ((((float) game.battle.oppPokemon.currentStats.get("hp").intValue()) * 48.0f) / ((float) game.battle.oppPokemon.maxStats.get("hp").intValue())));
        this.healthSprite = new SpriteProxy(new Color(0.9375f, 0.8125f, 0.46875f, 1.0f), TextureCache.get(Gdx.files.internal("battle/health1.png")), 0, 0, 1, 2);
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void firstStep(Game game) {
        if (game.battle.drawAction instanceof RegigigasBattle.Draw) {
            this.textDict = game.textDictInverse;
            this.bgSprite = new SpriteProxy(Color.BLACK, TextureCache.get(Gdx.files.internal("battle/enemy_healthbar1_inverse.png")), 0, 0, 160, 144);
            this.levelCharacter = new SpriteProxy(Color.BLACK, TextureCache.get(Gdx.files.internal("battle/enemy_levelchar_inverse.png")), 0, 0, 160, 144);
            return;
        }
        this.textDict = game.textDict;
        this.bgSprite = new SpriteProxy(Color.WHITE, TextureCache.get(Gdx.files.internal("battle/enemy_healthbar1.png")), 0, 0, 160, 144);
        this.levelCharacter = new SpriteProxy(Color.WHITE, TextureCache.get(Gdx.files.internal("battle/enemy_levelchar.png")), 0, 0, 160, 144);
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        if (shouldDraw) {
            this.bgSprite.setPosition(this.translateAmt.x, this.translateAmt.y);
            this.bgSprite.draw(game.uiBatch);
            char[] textArray = game.battle.oppPokemon.nickname.toUpperCase(Locale.ROOT).toCharArray();
            for (int i = 0; i < textArray.length; i++) {
                game.uiBatch.draw(this.textDict.get(Character.valueOf(textArray[i])), ((float) (8 + (8 * i))) + this.translateAmt.x, 136.0f);
            }
            if (game.battle.oppPokemon.status == null || game.battle.oppPokemon.status.equals("confuse") || game.battle.oppPokemon.status.equals("attract") || game.battle.oppPokemon.status.equals("curse")) {
                this.levelChars = String.valueOf(game.battle.oppPokemon.level).toCharArray();
                int offset = 0;
                if (this.levelChars.length < 3) {
                    game.uiBatch.draw(this.levelCharacter, 0.0f, 0.0f);
                    offset = 0 + 8;
                }
                for (char c : this.levelChars) {
                    game.uiBatch.draw(this.textDict.get(Character.valueOf(c)), ((float) (32 + offset)) + this.translateAmt.x, 128.0f);
                    offset += 8;
                }
            } else {
                String text = "";
                if (game.battle.oppPokemon.status.equals("poison") || game.battle.oppPokemon.status.equals("toxic")) {
                    text = "PSN";
                } else if (game.battle.oppPokemon.status.equals("paralyze")) {
                    text = "PAR";
                } else if (game.battle.oppPokemon.status.equals("freeze")) {
                    text = "FRZ";
                } else if (game.battle.oppPokemon.status.equals("sleep")) {
                    text = "SLP";
                } else if (game.battle.oppPokemon.status.equals("burn")) {
                    text = "BRN";
                }
                char[] textArray2 = text.toCharArray();
                for (int i2 = 0; i2 < textArray2.length; i2++) {
                    game.uiBatch.draw(this.textDict.get(Character.valueOf(textArray2[i2])), ((float) (32 + (8 * i2))) + this.translateAmt.x, 128.0f);
                }
            }
            for (int i3 = 0; i3 < this.currHealth; i3++) {
                game.uiBatch.draw(this.healthSprite, ((float) (32 + i3)) + this.translateAmt.x, 123.0f);
            }
            if (!game.battle.oppPokemon.isGhost) {
                if (game.battle.oppPokemon.gender.equals("male")) {
                    if (game.battle.drawAction instanceof RegigigasBattle.Draw) {
                        game.uiBatch.draw(TextureCache.maleSymbolInverse, 72.0f + this.translateAmt.x, 128.0f);
                    } else {
                        game.uiBatch.draw(TextureCache.maleSymbol, 72.0f + this.translateAmt.x, 128.0f);
                    }
                } else if (game.battle.oppPokemon.gender.equals("female")) {
                    if (game.battle.drawAction instanceof RegigigasBattle.Draw) {
                        game.uiBatch.draw(TextureCache.femaleSymbolInverse, 72.0f + this.translateAmt.x, 128.0f);
                    } else {
                        game.uiBatch.draw(TextureCache.femaleSymbol, 72.0f + this.translateAmt.x, 128.0f);
                    }
                }
            }
        }
        if (game.battle.drawAction == null) {
            game.actionStack.remove(this);
        }
    }
}
